#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
using namespace std;
int a[1005], l[1005];
int main()
{
	int i = 1, n = 0, p;
	while (cin >> a[i])
	{
		i++;
		n++;
	}
	int k = 1;
	l[k] = a[1];
	for (i = 2; i <= n; i++)
	{
		p = 0;
		for (int j = 1; j <= k; j++)
		{
			if (l[j] >= a[i])
			{
				if (p == 0)
				{
					p = j;
				}
				else if (l[j] < l[p])
				{
					p = j;
				}
			}
		}
		if (p == 0)
		{
			k++;
			l[k] = a[i];
		}
		else
		{
			l[p] = a[i];
		}
	}
	cout << k << endl;

	return 0;
}
